<?php
	class monhocdata
	{
		public function Them($monhoc_ma = "", $monhoc_ten = "",$monhoc_sotinchi = "",$monhoc_sotiet_lt = "",$monhoc_sotiet_th = "",$monhoc_truoc = "",$monhoc_tienquyet = "",$monhoc_mabomon = "")
		{
			$sql = "INSERT INTO monhoc(monhoc_ma, monhoc_ten,monhoc_sotinchi,monhoc_sotiet_lt,monhoc_sotiet_th,monhoc_truoc,monhoc_tienquyet,monhoc_mabomon)
					VALUES('$monhoc_ma', '$monhoc_ten','$monhoc_sotinchi','$monhoc_sotiet_lt','$monhoc_sotiet_th','$monhoc_truoc','$monhoc_tienquyet','$monhoc_mabomon')";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($monhoc_ma = "", $monhoc_ten = "",$monhoc_sotinchi = "",$monhoc_sotiet_lt = "",$monhoc_sotiet_th = "",$monhoc_truoc = "",$monhoc_tienquyet = "",$monhoc_mabomon = "")
		{
			$sql= "UPDATE `monhoc` SET `monhoc_ten`='$monhoc_ten',`monhoc_sotinchi`='$monhoc_sotinchi',`monhoc_sotiet_lt`='$monhoc_sotiet_lt',`monhoc_sotiet_th`='$monhoc_sotiet_th',`monhoc_truoc`='$monhoc_truoc',`monhoc_tienquyet`='$monhoc_tienquyet',`monhoc_mabomon`='$monhoc_mabomon' WHERE `monhoc_ma`='$monhoc_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function Xoa($monhoc_ma = "")
		{
			$sql = "DELETE  FROM monhoc WHERE monhoc_ma = '$monhoc_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach($monhoc_ma = "")
		{
			$sql = "SELECT * FROM monhoc WHERE 1";
			
			if($monhoc_ma != "")
				$sql .= " AND monhoc_ma = '$monhoc_ma'";
			
			$service = new dataservice();
			return $service->ExecuteQuery($sql);
		}
	}
?>